package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.UserInfo;
import com.atguigu.tingshu.user.client.impl.UserInfoDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * 
 */
@FeignClient(value = "service-user", fallback = UserInfoDegradeFeignClient.class)
public interface UserInfoFeignClient {

    @GetMapping("api/user/userInfo/getUserInfo/{userId}")
    Result<UserInfo> getUserInfo(@PathVariable Long userId);

    /**
     * 获取用户购买的该专辑的声音信息与免费试听声音id
     * @param albumId
     * @param allTrackIdList
     * @return
     */
    @PostMapping("api/user/userInfo/getPaidTrack/{albumId}")
    Result<List<Long>> getPaidTrack(@PathVariable Long albumId, @RequestBody List<Long> allTrackIdList);

    /**
     * 判断用户是否购买了该专辑
     * @param albumId
     * @return
     */
    @GetMapping("api/user/userInfo/isPaidAlbum/{albumId}")
    Result<Boolean> isPaidAlbum(@PathVariable("albumId") Long albumId);


    /**
     * 处理用户购买记录
     * @param userPaidRecordVo
     * @return
     */
    @PostMapping("api/user/userInfo/saveUserPaidRecord")
    Result<Boolean> saveUserPaidRecord(@RequestBody UserPaidRecordVo userPaidRecordVo);
}